package ihis.model;

import java.io.Serializable;
import java.util.Date;

/**
 * System에서 관리되는 단위의 할 일 정보
 * @author yoni230
 *
 */
public class Task  implements Serializable{
	private static final long serialVersionUID = -4660864373601667007L;
	/** Task */
	private String taskId;
	
	/** 제목  */
	private String subject;

	/** 담당자 */
	private String ownerId;

	/** 유형 : RISK | Delay */
	private int type;
	
	/** Project 아이디 : 프로젝트 명은 변경될 수 있으므로 아이디로 변경함 */
	private String projectId;
	
	/** '팀'으로 통일 : Redmine에서는 '범주' */
	private String teamId;
	/** 우선순위 : 현재 보고서에 보여지는 곳이 없으므로 삭제함 */
//	private String Priority;
	/** 상세설명 */
	private String description;
	
	/** 추정 : 데이터 보여주는 곳은 없으나 계산 시 필요함 => 성과 */
	private int estimation;
	
	/** 진척율 / 완료율 */
	private int progressRatio;
	
	/** 할일 상태 : 완료/진행 IHISConstants.PROGRESS_STATUS_XXX */
	private int status;
	
	/** 등록시점 */
	private Date startDate;
	/** 종료시점 */
	private Date dueDate;
	/** 완료시점 */
	private Date completedDate;
	
	/* (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		StringBuilder sb = new StringBuilder();
		sb.append(taskId).append(", PID: ").append(projectId).append(", TID: ").append(teamId).append(", USER: ").append(ownerId)
			.append(", Name: ").append(subject).append(" Due: ").append(dueDate).append(" Ratio: ").append(progressRatio);
		return sb.toString();
	}
	
	public String getSubject() {
		return subject;
	}
	public void setSubject(String subject) {
		this.subject = subject;
	}
	public String getOwnerId() {
		return ownerId;
	}
	public void setOwnerId(String owner) {
		this.ownerId = owner;
	}
	
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	public int getEstimation() {
		return estimation;
	}
	public void setEstimation(int estimation) {
		this.estimation = estimation;
	}
	public Date getStartDate() {
		return startDate;
	}
	public void setStartDate(Date startDate) {
		this.startDate = startDate;
	}
	public Date getDueDate() {
		return dueDate;
	}
	public void setDueDate(Date dueDate) {
		this.dueDate = dueDate;
	}
	/**
	 * @return the taskId
	 */
	public String getTaskId() {
		return taskId;
	}
	/**
	 * @param taskId the taskId to set
	 */
	public void setTaskId(String taskId) {
		this.taskId = taskId;
	}
	public Date getCompletedDate() {
		return completedDate;
	}
	public void setCompletedDate(Date completedDate) {
		this.completedDate = completedDate;
	}
	public int getType() {
		return type;
	}
	public void setType(int type) {
		this.type = type;
	}
	public String getProjectId() {
		return projectId;
	}
	public void setProjectId(String projectId) {
		this.projectId = projectId;
	}
	public String getTeamId() {
		return teamId;
	}
	public void setTeamId(String teamId) {
		this.teamId = teamId;
	}
	/**
	 * @return the progressRatio
	 */
	public int getProgressRatio() {
		return progressRatio;
	}
	/**
	 * @param progressRatio the progressRatio to set
	 */
	public void setProgressRatio(int progressRatio) {
		if(progressRatio < 0)
			this.progressRatio = 0;
		else if(progressRatio > 100)
			progressRatio = 100;
		
		this.progressRatio = progressRatio;
	}
	/**
	 * @return the status
	 */
	public int getStatus() {
		return status;
	}
	
	public String getStatusMessage(){
		return IHISConstants.STATUS_MESSAGE[this.status];
	}
	
	/**
	 * @param status the status to set
	 */
	public void setStatus(int status) {
		this.status = status;
	}
	
}
